#!/usr/bin/env bash

echo 'start independent starting...'

# 阿拉伯数字18作为异常退出码
check='[ $? -eq 0 ] || exit 18'

eval "$check" && echo '启动服务'
if [[ -z $(ps -ef|grep openresty|grep -v grep) ]];
then
  eval "$check" && openresty &
fi
if [[ -z $(ps -ef|grep mongod|grep -v grep) ]];
then
  eval "$check" && mongod &
fi
if [[ -z $(ps -ef|grep redis-server|grep -v grep) ]];
then
  eval "$check" && redis-server &
fi
eval "$check" && bash ../aurelia/start.sh
eval "$check" && bash ../turritopsis/start.sh

eval "$check" && echo "finish independent starting！！！"

tail -f /dev/null

